<template>
	<view>
		<!-- <nav-bar>{{pageTitle}}</nav-bar> -->
		<nav-bar fontColor="#000" :scrollTop="0" :bgColor="['#f00','#00cdff']" :title="pageTitle"></nav-bar>

		<web-view class="webview" :webview-styles="webviewStyles" :src="url" @message="getMessage"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				webviewStyles: {
					progress: {
						color: 'red'
					},
				},
				url: '',
				fileToken: '',
				userId: 0,
				pptId: 0,
				courseId: 0,
				classId: 0,
				token: '',
				pageTitle: 'web标题'
			}
		},
		onLoad(option) {

			// this.fileToken = option.fileToken;
			// this.pptId = option.pptId;
			// this.courseId = option.courseId;
			// this.classId = option.classId;
			// this.lessonId = option.lessonId;
			// this.isLesson = option.isLesson || 0;
			this.pageTitle = option.title;
			this.url = option.url;
			// this.url = "/hybrid/html/index.html";
			// <web-view src="/hybrid/html/local.html" @message="getMessage"></web-view>
		},
		onShow() {
			console.log('office-webview onshow')
		},

		methods: {
			getMessage(e) {
				console.log(e)
				uni.showModal({
					content: /* JSON.stringify(e.detail) */ e.detail,
					showCancel: false
				})
			}
		}
	}
</script>

<style>
	.webview {
		padding-top: 50upx;
	}
</style>
